package m.jclecai.com.adapter.holder;

import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import m.jclecai.com.R;
import m.jclecai.com.bean.reconmend.ReconmentRecord;
import m.jclecai.com.data.Lecai_SDK;
import m.jclecai.com.fragment.RecommendFragment;
import m.jclecai.com.listener.Callback;

/**
 * Created by ZD on 2017/7/19.
 */

public class RmfamousItemHolder extends RecyclerView.ViewHolder {

    private Callback mCallback;
    private ReconmentRecord record ;
    @BindView(R.id.tv_desc)
    TextView tv_desc;

    @BindView(R.id.tv_name_type)
    TextView tv_name_type;

    @BindView(R.id.tv_status)
    TextView tv_status;

    @BindView(R.id.tv_start_time)
    TextView tv_start_time;

    @BindView(R.id.tv_money)
    TextView tv_money;


    @BindView(R.id.tv_add_point)
    TextView tv_add_point;




    public RmfamousItemHolder(View itemView) {
        super(itemView);
        ButterKnife.bind(this,itemView);
    }

    public void init(Callback mCallback, ReconmentRecord record){
        this.mCallback = mCallback;
        this.record = record;
        initValues(record);
    }

    /**
     *  绑定数据
     * @param record
     */
    private  void initValues(ReconmentRecord record){
        tv_desc.setText(record.title);
        tv_name_type.setText(record.type);
        tv_status.setText(record.type);
        tv_start_time.setText("开赛时间:"+record.matchtime);
        tv_money.setText(record.one_money+"元");
        tv_add_point.setText("+"+record.goldcoin+"积分");

    }

    @OnClick(R.id.ll_body)
    void toRmDetail(){
        if(mCallback != null)
            Lecai_SDK.id = record.id;
            mCallback.callback(RecommendFragment.JUMP.RmDetailActivity);
    }
}
